package com.recruit.wechat.utils.dictutils;

import freemarker.template.Configuration;
import freemarker.template.TemplateModelException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @author LF
 * @date 2020/9/2 - 11:30
 */
@Component
public class FreemarkerConfig {
    @Autowired
    private Configuration configuration;
    @Autowired
    private DictDirective dictDirective;
    @Autowired
    private PersonalDirective personalDirective;
    @Autowired
    private ResumeDirective resumeDirective;
    @Autowired
    private EnclosureDirective enclosureDirective;
    @Autowired
    private PositionDirective positionDirective;
    @Autowired
    private IndustryDirective industryDirective;

    @PostConstruct
    public void setSharedVariable() throws TemplateModelException {
        configuration.setSharedVariable("dict_tag", dictDirective);
        configuration.setSharedVariable("personal_tag", personalDirective);
        configuration.setSharedVariable("resume_tag", resumeDirective);
        configuration.setSharedVariable("enclosure_tag", enclosureDirective);
        configuration.setSharedVariable("position_tag", positionDirective);
        configuration.setSharedVariable("industry_tag", industryDirective);
    }
}
